{__NOLAYOUT__}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script src="__COMMON__/js/zepto/zepto.min.js" charset="utf-8"></script>
</head>
<body>
<form action="?" method="post">
cid: <input name="cid" value="{$cid}"><br/>
开始时间: <input name="stime" value="{$startTime|date='Y-m-d H:i:s',###}"><br/>
结束时间: <input name="etime" value="{$endTime|date='Y-m-d H:i:s',###}"><br/>
<input type="submit">
</form>

<if condition="!empty($userList)">
<script type="text/javascript">
var userList = {:json_encode($userList)},
	count = userList.length,
	i = 0,
	timer = 0;

(function doing() {
	var data = {
		'id': userList[i]
	};
	$.ajax({
		'url': '__CONTROLLER__/ajaxUserSales',
		'type': 'post',
		'data': data,
		'success': function(res) {
			if ( !res.error ) {
				if ( i == count ) {
					$("#load").hide();
					$("#view").show();
					clearTimeout(timer);
				} else {
					$("#load").html("LOADING...("+(i+1)+'/'+count+")");
					i++;
				}
			}
			timer = setTimeout(doing, 1);
		}, 
		'error': function() {
			timer = setTimeout(doing, 1);
		}
	});
})();
</script>
</if>
<if condition="IS_POST">
<div id="load">LOADING...</div>
<div id="view"><a href="__CONTROLLER__/showUserSales">查看结果</div>
</if>
</body>
</html>